package com.krain.ddbb.activity;



import android.content.Intent;
import android.support.v4.widget.NestedScrollView;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;

import com.krain.corelibrary.widget.loadingView.LoadingView;
import com.krain.corelibrary.widget.silderview.SliderLayout;
import com.krain.ddbb.R;
import com.krain.ddbb.base.BaseActivity;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

@EActivity(R.layout.activity_user_center)
public class UserCenterActivity extends BaseActivity {


    @ViewById(R.id.act_usercenter_nav_view)
    NestedScrollView mScrollView;


    @AfterViews
    void afterView() {
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main, menu);
        MenuItem item = menu.findItem(R.id.action_search);
        item.setIcon(R.mipmap.share_icon);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if(id==R.id.action_search){
           Intent intent=new Intent(Intent.ACTION_SEND);
            intent.setType("text/plain");
            intent.putExtra(Intent.EXTRA_SUBJECT, "分享");
            intent.putExtra(Intent.EXTRA_TEXT, "很好用的app,快来下载吧！http://120.55.161.226");
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(Intent.createChooser(intent, getTitle()));
        }
        return super.onOptionsItemSelected(item);
    }



    @Click(R.id.act_center_tv_evaluation)
    void clickToUserRemark(){
        ServiceRemarkListActivity.jumpTothisActivity(this);
    }

    @Click(R.id.act_center_tv_task)
    void clickToUserTask(){
        UserOrderActivity.jumpTothisActivity(this);
    }

    @Click(R.id.act_center_tv_account)
    void clickToUserAccount(){
        UserAccountActivity.jumpTothisActivity(this);
    }

    @Click(R.id.act_center_tv_userinfo)
    void clickToUserInfo(){
        UserInfoActivity.jumpTothisActivity(this);
    }

    @Click(R.id.act_center_btn_exit)
    void clickToLogout(){
        app.clearUserInfo();
        LoginActivity.jumpTothisActivity(mContext);
        finish();
    }

    public static void jumpTothisActivity(BaseActivity activity) {
        Intent intent = new Intent(activity, UserCenterActivity_.class);
        activity.startActivity(intent);
    }

    @Override
    protected String getToolbarTitle() {
        return "我的";
    }
}
